package com.gitee.wsl.doc.prosemirror.model.node.ext

import com.gitee.wsl.doc.prosemirror.model.mark.Mark
import com.gitee.wsl.doc.prosemirror.model.node.Node
import com.gitee.wsl.doc.prosemirror.model.node.inline.TextNode

fun maybeMerge(a: Node, b: Node): Node? {
    if (a.isText && b.isText && Mark.sameSet(a.marks, b.marks))
        return (a as TextNode).withText(a.text + b.text)
    return null
}